package com.ccrfid.rmc6.service.vehicle;

import com.ccrfid.rmc6.appconfig.exception.pojo.AppException;
import com.ccrfid.rmc6.entity.vehicle.VehicleEntity;
import com.ccrfid.rmc6.entity.vehicle.VehicleEntryRecordView;
import com.ccrfid.rmc6.entity.vehicle.VehicleMoveEntity;
import com.ccrfid.rmc6.lbservice3.pojo.msg.MsgLocate;
import com.ccrfid.rmc6.pojo.dto.LocatorAssetCount;
import com.ccrfid.rmc6.pojo.dto.vehicle.VehicleInfoDto;
import com.ccrfid.rmc6.pojo.dto.vehicle.VehicleMoveInLocationDto;
import com.ccrfid.rmc6.repository.search.SearchCriteria;
import com.vividsolutions.jts.geom.Polygon;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.sql.Timestamp;
import java.util.List;

public interface VehicleService {
    //分页查询车辆列表
    Page<VehicleEntity> getVehiclePage(SearchCriteria criteria, Pageable pageable);

    //获取单个车辆信息
    VehicleEntity getVehicleById(Long vehicleId) throws AppException;

    VehicleEntity getVehicleByCardNumber(Long cardNumber);

    //新增车辆信息
    VehicleEntity createVehicle(VehicleEntity entity) throws AppException;

    //更新车辆信息
    VehicleEntity updateVehicle(Long vehicleId, VehicleEntity entity) throws AppException;

    //删除车辆信息
    Boolean deleteVehicle(Long vehicleId) throws AppException;

    //获取车辆图片
    byte[] getVehiclePhoto(Long vehicleId) throws AppException;

    //更新车辆图片
    Boolean updateVehiclePhoto(Long vehicleId, byte[] image) throws AppException;

    //删除车辆图片
    Boolean deleteVehiclePhoto(Long vehicleId) throws AppException;

    //车辆进入
    Boolean vehicleEntry(Long vehicleId) throws AppException;

    //车辆离开
    Boolean vehicleLeave(Long vehicleId) throws AppException;

    //外来车辆进出记录查询
    Page<VehicleEntryRecordView> getVehicleEntryRecords(SearchCriteria criteria, Pageable pageable);

    //记录车辆历史轨迹
    VehicleMoveEntity recordVehicleMove(Long vehicleId, MsgLocate msgLocate);

    //查询车辆分布
    List<LocatorAssetCount> getVehicleDistribution(Integer floorNumber);

    //查询某个定位器下的车辆信息
    List<VehicleEntity> getVehicleUnderLocator(Integer locatorNumber);

    //查询某个位置下的车辆信息
    List<VehicleEntity> getVehicleUnderPos(double x, double y);

    //查询某个车辆轨迹
    List<VehicleMoveInLocationDto> getVehicleMoveLocationList(Long vehicleId, Timestamp startTime, Timestamp endTime);

    //根据车牌号查询车辆信息
    List<VehicleInfoDto> getVehicleByPlateNumber(String plateNumber);
    //查询人员实时定位
    List<VehicleInfoDto> getVehicleInPolygon(Integer floorNumber, Polygon polygon);
}
